<template>
  <div class="menu-left">
    <MenuTree :menuData="this.menuData" />  <!--3、使用组件-->
  </div>
</template>

<script>
import $http from '../request/http.js'
import MenuTree from './MenuTree'  //1、引用组件


export default {
  name: 'leftMenu',
  components: {
    MenuTree  //2、挂载组件
  },
  data () {
    return {
      menuData: []
    }
  },

  methods: {
    getMenus: function () {
      let userid = localStorage.getItem("userid");
      if (userid) {
        $http.get(`/Menu/menutree/${userid}`).then(res => {
          this.menuData = res.data.Data;
        })
      }
    }
  },
  created () {
    this.getMenus();
  },
}
</script>

<style  scoped>
.menu-left {
  width: 203px;
  position: fixed;
  top: 71px;
  left: 0;
  min-height: 100%;
  background-color: #324057;
  z-index: 99;
}
</style>